//
//  VisitDocAdviceCell.m
//  Doctor
//
//  Created by 阳光 on 16/10/8.
//  Copyright © 2016年 阳光. All rights reserved.
//  就诊病人病例详情中的医嘱

#import "VisitDocAdviceCell.h"
#import "QBBaseMainVC.h"

@interface VisitDocAdviceCell ()

// 药名
@property(nonatomic,strong)UILabel *drugLabel;

// 时间
@property(nonatomic,strong)UILabel *timeLabel;

// 开始时间
@property(nonatomic,strong)UILabel *beginTimeLabel;

// 结束时间
@property(nonatomic,strong)UILabel *endTimeLabel;

@end

@implementation VisitDocAdviceCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        self.drugLabel.font=Font_Number(16);
        self.timeLabel.font=Font_Number(16);
        self.beginTimeLabel.font=Font_Number(16);
        self.endTimeLabel.font=Font_Number(16);
    };
    return self;
}

// drugLabel
-(UILabel *)drugLabel
{
    if (!_drugLabel) {
        _drugLabel=[self getLabelWithText:@"张三" font:Font_Number(16) textColor:Color333333 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_drugLabel];
        [_drugLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.mas_equalTo(kmargin);
//            make.right.mas_equalTo(self.enameLabel.mas_left).offset(-kmargin);
        }];
    }
    return _drugLabel;
}

//// timeLabel
//-(UILabel *)timeLabel
//{
//    if (!_timeLabel) {
//        _timeLabel=[self getLabelWithText:@"zhangsan" font:Font_Number(16) textColor:Color666666 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
//        [self.contentView addSubview:_timeLabel];
//        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.mas_equalTo(self.drugLabel.mas_right).offset(kmargin);
//            make.centerY.mas_equalTo(self.drugLabel.mas_centerY);
//        }];
//    }
//    return _timeLabel;
//}

// beginTimeLabel
-(UILabel *)beginTimeLabel
{
    if (!_beginTimeLabel) {
        _beginTimeLabel=[self getLabelWithText:@"zhangsan" font:Font_Number(16) textColor:Color666666 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_beginTimeLabel];
        [_beginTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(kmargin);
            make.top.mas_equalTo(self.drugLabel.mas_bottom).offset(kmargin);
        }];
    }
    return _beginTimeLabel;
}

// endTimeLabel
-(UILabel *)endTimeLabel
{
    if (!_endTimeLabel) {
        _endTimeLabel=[self getLabelWithText:@"zhangsan" font:Font_Number(16) textColor:Color666666 textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_endTimeLabel];
        [_endTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(kmargin);
            make.top.mas_equalTo(self.beginTimeLabel.mas_bottom).offset(kmargin);
        }];
    }
    return _endTimeLabel;
}

-(void)setVisitDocAdviceListModel:(VisitDocAdviceListModel *)visitDocAdviceListModel
{
    _visitDocAdviceListModel=visitDocAdviceListModel;
    _drugLabel.text=visitDocAdviceListModel.type_name;
    _drugLabel.text=[NSString stringWithFormat:@"%@  %@  %@",[Util changCodeToName:visitDocAdviceListModel.type_name],[Util changDrugCodeToName:visitDocAdviceListModel.drug],[Util changHowMuchCodeToName:visitDocAdviceListModel.dose]];
    
    _beginTimeLabel.text=[NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"Start Time", nil),visitDocAdviceListModel.start_time];//开始时间
    _endTimeLabel.text=[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"End Time", nil),visitDocAdviceListModel.end_time];//结束时间

}


@end
